package Text25;
import java.util.*;
public class Main {
    public static int N = 1010;
    public static int[] a = new int[N];
    public static int[] f = new int[N];
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 1; i <= n; i++) {
            a[i]=scanner.nextInt();
        }
        for (int i = 1; i <=n ; i++) {
            for (int j = 1; j <=i-1 ; j++) {
                if(a[i]>a[j]){
                    f[i]=Math.max(f[i],f[j]+1);
                }
            }
        }
        int res=0;
        for (int i = 1; i <=n ; i++) {
            res=Math.max(res,f[i]);
        }
        System.out.println(res);
    }
}

